<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>法律人</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/my-style.css">
	<!--[if lt IE 9]> 
		<script src="js/html5shiv.min.js"></script> 
	<![endif]-->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function() {
			
			$('#list-select-ul1 li').click(function() {
				var pId = $("#data").data("p");
				var cId = $("#data").data("c");
				var yId = $("#data").data("y");
				var typeId = $(this).attr("id");
				location.href = "lawyer/list?typeId="+typeId+"&yearId="+yId+"&province="+pId+"&city="+cId;
			});
			
			$('#list-select-ul2 li').click(function() {
				var tId = $("#data").data("t");
				var pId = $("#data").data("p");
				var cId = $("#data").data("c");
				var yearId = $(this).attr("id");
				location.href = "lawyer/list?typeId="+tId+"&yearId="+yearId+"&province="+pId+"&city="+cId;
			});
			
			$("#province").change(function(){
				   $("#city option:not(:first)").remove();
				   var tId = $("#data").data("t");
				   var yId = $("#data").data("y");
				   var provinceId = $(this).val();
				   var url = "lawyer/list?typeId="+tId+"&yearId="+yId+"&province="+provinceId;
				   location.href=url;
			});
			$("#city").change(function(){
				   var cityId = $(this).val();
				   var pId = $("#data").data("p");
				   var tId = $("#data").data("t");
				   var yId = $("#data").data("y");
				   var url = "lawyer/list?typeId="+tId+"&yearId="+yId+"&province="+pId+"&city="+cityId;
				   location.href=url;
			});
		});
</script>
</head>
<body>
	<!-- 导航栏 -->
	<header>
		<nav class="navbar navbar-inverse">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
		        <span class="sr-only">Toggle navigation</span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
		      <a class="navbar-brand" href="index.html">
		        <img alt="LOGO" src="img/50x30.png">
		      </a>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse-1">
					<ul class="nav navbar-nav navbar-left">
						  <li><a href="index/home">首页</a></li>
				          <li class="cur"><a href="lawyer/list">法律人</a></li>
				          <li><a href="contract/list">法律产品</a></li>
				          <li><a href="knowledge/index">法律知识</a></li>
				          <li><a href="javascript:;">招聘</a></li>
					</ul>

					<ul class="nav navbar-nav navbar-right">
						<li><a class="add-btn" href="index/join">法律人入驻<span class="caret"></span></a></li>
				<c:if test="${sessionScope.user == null}">
					<li><a href="user/login">登录</a></li>
					<li><a href="user/register">注册</a></li>
				</c:if>
				<c:if test="${sessionScope.user != null}">
					     <li>
								<c:if test="${sessionScope.user.type  == 0}">
								<a href="user/person">${sessionScope.user.username}</a>
								</c:if>
								<c:if test="${sessionScope.user.type  == 1}">
								<a href="lawyer/person">${sessionScope.user.username}</a>
								</c:if>
								<c:if test="${sessionScope.user.type  == 2}">
								<a href="lawyer/person">${sessionScope.user.username}</a>
								</c:if>
					    </li>
					<li><a href="user/logout">退出</a></li>
				</c:if>
			</ul>
				</div>
			</div>
		</nav>
	</header>

	<section class="lawyer">
		<div class="container">
			<div class="row">
				<div class="col-md-12 col-sm-12 col-xs-12">
					<div class="list-select-border">
						<div class="list-select-box clearfix">
							<div class="pull-left list-label">
								<label>服务类型:</label>
							</div>
							<div class="pull-left list-select">
								<ul class="list-select-ul clearfix" id="list-select-ul1">
										<c:choose>
												<c:when test="${typeId == 0}">
														<li class="selected" id="0"><a href="javascript:;">全部</a></li>
												</c:when>
												<c:otherwise>
																<li id="0"><a href="javascript:;">全部</a></li>
												</c:otherwise>
										</c:choose>
										<c:forEach items="${serviceTypes}" var="serviceTypes">
										<c:choose>
										<c:when test="${serviceTypes.serviceid == typeId}">
												<li class="selected" id="${serviceTypes.serviceid}" data-t="${typeId}" data-p="${province}" data-c="${city}"><a href="lawyer/list?typeId=${serviceTypes.serviceid}">${serviceTypes.name}</a></li>
										</c:when>
										<c:otherwise>
														<li id="${serviceTypes.serviceid}"><a href="javascript:;">${serviceTypes.name}</a></li>
										</c:otherwise>
										</c:choose>
										</c:forEach>
								</ul>
								<input type="hidden" id="data" data-t="${typeId}" data-p="${province}" data-c="${city}" data-y="${yearId}">
							</div>
						</div>
						

						<div class="list-select-box clearfix">
							<div class="pull-left list-label">
								<label>执业年限:</label>
							</div>
							<div class="pull-left list-select">
								<ul class="list-select-ul clearfix" id="list-select-ul2">
									<li <c:if test="${yearId==0}">class="selected"</c:if> id="0"><a href="javascript:;">全部</a></li>
									<li id="1" <c:if test="${yearId==1}">class="selected"</c:if> data-t="${typeId}" data-p="${province}" data-c="${city}">
										<a href="javascript:;">5年以下</a>
									</li>
									<li id="2" <c:if test="${yearId==2}">class="selected"</c:if> data-t="${typeId}" data-p="${province}" data-c="${city}">
										<a href="javascript:;">5-10年</a>
									</li>
									<li id="3" <c:if test="${yearId==3}">class="selected"</c:if> data-t="${typeId}" data-p="${province}" data-c="${city}">
										<a href="javascript:;">10年以上</a>
									</li>
								</ul>
							</div>
						</div>

						<div class="list-select-box clearfix">
							<form>
							<div class="pull-left list-label">
								<label>地区选择:</label>
							</div>
							<div class="pull-left list-select" style="margin-top:5px;">
								<div class="form-group">
									<div class="col-sm-2">
										<select class="form-control input-sm" id="province" name="province">
											  <option value="0">请选择省市</option>
											  <option value="1" <c:if test="${province == 1}">selected="selected"</c:if>>山西</option>
											  <option value="2" <c:if test="${province == 2}">selected="selected"</c:if>>天津</option>
										</select>
									</div>
									<div class="col-sm-2">
									<select class="form-control input-sm" id="city" name="city">
									  	<option value="0">请选择市区</option>
									  	<c:forEach items="${citys}" var="citys">
									  		<option value="${citys.cityId}"  <c:if test="${citys.cityId == city}">selected="selected"</c:if>>${citys.city}</option>
									  	</c:forEach>
									</select>
									</div>
								</div>
							</div>
								
							</form>
						</div>
						
					</div>
				
				</div>
			</div>
			<div class="row" style="margin-top: 20px;">
				<div class=" col-md-8 col-sm-8 col-xs-12 main-lawyer">
					<c:forEach items="${lawyersDetails}" var="lawyersDetails">
									<div class="media">
						  <div class="media-left">
						    <a href="#">
						    	<img class="media-object" src="http://localhost:8080/${lawyersDetails.idcardimg}" alt="..." style="height:150px ;width:120px">
						    </a>
						  </div>
						  <div class="media-body">
						    <div class="media-left">
						    	<h3 class="media-heading">${lawyersDetails.name}律师</h3>
						    	<i class="icon icon-like">1700</i>
							    <div class="media-content">
							    	<span class="icon icon-home-outline">${lawyersDetails.lawoffice}</span>
							    	<span class="icon icon-location">${lawyersDetails.provinceName}</span>
							    	<span class="icon icon-clock">执业年限:
											<c:choose>
									    			<c:when test="${lawyersDetails.membership == 1}">5年以下</c:when>
									    			<c:when test="${lawyersDetails.membership == 2}">5~10年</c:when>
									    			<c:otherwise>10年以上</c:otherwise>
									    	</c:choose>
									</span>
							    </div>		
							    <div class="media-content">
										<label>${lawyersDetails.specialNameA}</label>
								    <label>${lawyersDetails.specialNameB}</label>
								    <label>${lawyersDetails.specialNameC}</label>
							    </div>			 
						    </div> 							
						  </div>
						  <div class="media-right">
								<a href="lawyer/detail/${lawyersDetails.lawyerid}" class="btn-square">
									咨询律师
								</a>
							</div>
						</div>
					</c:forEach>
					
					
						<c:forEach items="${studentsDetails}" var="studentsDetails">
									<div class="media">
						  <div class="media-left">
						    <a href="#">
						    	<img class="media-object" src="http://localhost:8080/${studentsDetails.idcardimg}" alt="..." style="height:150px ;width:120px">
						    </a>
						  </div>
						  <div class="media-body">
						    <div class="media-left">
						    	<h3 class="media-heading">${studentsDetails.name}律师</h3>
						    	<i class="icon icon-like">1700</i>
							    <div class="media-content">
							    	<span class="icon icon-home-outline">${studentsDetails.address}</span>
							    	<span class="icon icon-location">${studentsDetails.provinceName}</span>
							    	<span class="icon icon-clock">执业年限:
							    	<c:choose>
							    			<c:when test="${studentsDetails.membership == 1}">5年以下</c:when>
							    			<c:when test="${studentsDetails.membership == 2}">5~10年</c:when>
							    			<c:otherwise>10年以上</c:otherwise>
							    	</c:choose>
							    	</span>
							    </div>		
							    <div class="media-content">
										<label>${studentsDetails.specialNameA}</label>
							    </div>			 
						    </div> 							
						  </div>
						  <div class="media-right">
								<a href="lawyer/other/detail/${studentsDetails.studentid}" class="btn-square">
									咨询律师
								</a>
							</div>
						</div>
					</c:forEach>
			


				
			</div>
			<div class="col-sm-4 col-md-4 hidden-xs">
					<div class="col-md-12 text-center hidden-xs clear-padding">
						<img src="img/lawadvertisement.png" alt="">
					</div>
					<div class="col-md-12 col-sm-12 hidden-xs clear-padding center-block">
						<div class="sidebar-box">
							<h4>推荐律师</h4>
							<hr>
							<c:forEach items="${recomLawyer}" var="recomLawyer">
							<div class="media">
							  <div class="media-left">
							    <a href="#">
							    	<img class="media-object" src="img/100x120.png" alt="...">
							    </a>
							  </div>
							  <div class="media-body">
							    <div class="media-left">
							    	<h3 class="media-heading">${recomLawyer.name}律师</h3>
							    	<i class="icon icon-like">1700</i>
								    <div class="media-content">
								    	<span class="icon icon-home-outline">${recomLawyer.lawoffice}</span>
								    </div>		
									 	<div class="media-content">
								    	<a class="btn btn-primary" href="lawyer/detail/${recomLawyer.lawyerid}" style="margin-top:11px;">咨询律师</a>
								    </div>
							    </div> 							
							  </div>							  
							</div>
							</c:forEach>





						</div>
					</div>

			</div>
		</div>
	</section>

</body>
</html>